import { ComponentProps, VueComponent } from "vue3-oop"
import { WidgetNode } from '../../types'
import { DynamicWidget } from '../index'

import GridView from '../layouts/grid/GridView'

interface IProps {
  widgetNode: WidgetNode
}
export default class WidgetView extends VueComponent<IProps> {
  static defaultProps: ComponentProps<IProps> = {
    widgetNode: {}
  }

  constructor(
  ){
    super();
  }

  render() {
    const { widgetNode } = this.props;
    const props = { widgetNode };
    return DynamicWidget[widgetNode.widgetType]?.VIEW?h(DynamicWidget[widgetNode.widgetType].VIEW(),props):null;
  }
}